﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
dim typeid,page,sort,keyword
typeid=GetIntQueryString("id")
page=GetIntQueryString("page")
S_LANG=GetIntQueryString("lang")
sort=GetIntQueryString("sort")
keyword=Trim(request.querystring("keyword"))
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
checkadmin(1)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%out("lang_productlist")%></title>
<link type="text/css" href="style/style.css" rel="stylesheet" rev="stylesheet"/>
<script type="text/javascript" language="javascript" src="admin_js/common.js"></script>
<script type="text/javascript" language="javascript" src="admin_js/net.js"></script>
</head>
<body>
<div class="addrecord">
<%call ShowMyChild("product",typeid)%>
</div>
<div style="width:600px;margin:0px auto;">
快速定位：<input type="text" name="name" onkeyup="ajax_checkWord('product',this.value);"/>（请输入你要检索的关键字，然后点击相应项，请输入两个以上字符）
<div id="showlayer" style="position:relative;display:none;"><div style="margin-left:0px;border:1px;cursor:pointer;background:#99FF00;width:100px;height:14px;background:url(images/close.gif)" onclick="document.getElementById('showlayer').style.display='none';"></div>
<div id="show" style="position:absolute;left:0px;top:15px;background:#FFFF99;border:1px solid;overflow:auto; width:500px;height:150px;"></div>
</div>
</div>
<form name="rzform" method="post" id="rzform">
<input type="hidden" name="listtype" value="product"/>
<input type="hidden" name="lang" value="<%=S_LANG%>"/>
<table  cellspacing="0" cellpadding="0" class="table_800">
<tr>
<th><%out("lang_select")%></th>
<th><%out("lang_order")%></th>
<th><a href="?sort=0" title="按ID排序">ID</a></th>
<th><%out("lang_model")%></th>
<th><a href="?sort=1" title="按名称排序"><%out("lang_productname")%></a></th>
<th class='tdcenter'><%out("lang_category")%></th>
<th><%out("lang_photo")%></th>
<th><%out("lang_addtime")%></th>
<th><%out("lang_author")%></th>
<th><%out("lang_action")%></th>
</tr>
<%
Dim sortstr
If sort=1 Then
	sortstr="productname"
Else
	sortstr="id desc"
End If 

dim sql,MyPage,rs,i
If keyword<>"" Then 
keyword=unescape(keyword)
keyword=Replace(keyword,"[","[[")
keyword=Replace(keyword,"]","]]")
	sql="select id,productid,productname,productimg,typeid,path,author,addtime,lang,visible,specialid from c_product where  productname like '%"&keyword&"%'   order by "&sortstr
else
	if typeid=0 then
	sql="select id,productid,productname,productimg,typeid,path,author,addtime,lang,visible,specialid from c_product where lang="&S_LANG&"  order by "&sortstr
	else 
	sql="select id,productid,productname,productimg,typeid,path,author,addtime,lang,visible,specialid from c_product  where lang="&S_LANG&"  and path like '%,"&cstr(typeid)&",%'   order by "&sortstr
	end if 
End If 
Set MyPage = New RZPage
MyPage.SetSQL = sql
MyPage.PageSize = 20
MyPage.SetCss_PreNext="nextprev"
MyPage.SetCss_NumPage="pagenum"
MyPage.SetCss_CurrentPage="currentpage"
Set rs = MyPage.GetRS()
dim LinkURL
For i=1 To MyPage.PageSize
If Not rs.EOF Then 
%> 
<tr class="row">
<td><input type="checkbox" name="id" id="id" value="<%=rs("id")%>"  onclick="chkRow(this);"/></td>
<td>
<%
if page<=1 then 
response.write(i)
else
response.write((page-1)*20+i)
end if 
%>
</td>
<td><a href="#" title="复制ID到剪贴板" style="cursor:pointer;font-size:14px;font-weight:bold;" onclick="toClipboard('<%=rs("id")%>'); "><%=rs("id")%></a></td>
<td>
<%=rs("productid")%>
</td>
<td>
<%
Dim path
path=CutPath(rs("path"))
LinkURL="../index.asp?"&RZ_PRE_PRODUCT_SHOW&rs("lang")&"-t"&path&"c"&rs("id")&".html"
If rs("specialid")>0 Then
	LinkURL="../index.asp?"&RZ_PRE_PRODUCT_SHOW&rs("lang")&"-t"&path&"s"&rs("specialid")&"c"&rs("id")&".html"
End If 
%>
<a href="<%=LinkURL%>" target="_blank"><%=rs("productname")%></a></td>
<td class='tdcenter'><%Dim rs0,sql0
Set rs0=server.CreateObject("adodb.recordset")
sql0="select * from [c_type] where id="&rs("typeid")
rs0.open sql0,conn,1,1
If Not rs0.eof Then
If rs0("havechild")=1 Then
%>
<a href='product_list.asp?id=<%=rs("typeid")%>&lang=<%=S_LANG%>' title='该记录不是位于最终子分类，将会导致静态HTML的时候出错，请通过“批量修改分类”来修改分类并重新生成静态页'><span style='color:red'>错误警告！</span></a>
<%Else%>
<a href="product_list.asp?id=<%=rs("typeid")%>&lang=<%=S_LANG%>"><%=rs0("name")%></a>
<%
End If 
Else
response.write("<a href='#' title='找不到分类，请修改分类并重新生成静态页'><span style='color:red'>错误警告！</span></a>")
End If 
rs0.close
Set rs0=Nothing 
%>
</td>
<td>
<%if rs("productimg")<>"" then%>
<a href="#" onclick="ajax_previewPhoto('<%=rs("productimg")%>');"><%out("lang_preview")%></a>
<%else%>
<%out("lang_nophoto")%>
<%end if%>
<div style="position:relative;"><div id="photoviewer"></div></div>
</td>
<td><%=year(rs("addtime"))%>-<%=month(rs("addtime"))%>-<%=day(rs("addtime"))%></td>
<td align="center"><%=rs("author")%></td>
<td align="center">
<a href="product_add.asp?id=<%=rs("id")%>&lang=<%=S_LANG%>"><img src='images/modify.gif' alt='<%out("lang_edit")%>' border='0'/></a>&nbsp;<a href="product_delete.asp?id=<%=rs("id")%>&lang=<%=S_LANG%>"  onclick="return confirm('<%out("lang_checkdelete")%>');"><img src='images/delete.gif' alt='<%out("lang_delete")%>' border='0'/></a>
&nbsp;
</td>
</tr>
<%
rs.Movenext
Else
Exit For
End If
Next
%>
<tr>
<td colspan="10" class="tdcenter">
<input name="selectall" type="checkbox" id="selectall" value="" onclick="selectAll();" /><%out("lang_selectall")%>&nbsp;&nbsp;&nbsp;<input type="button"  class="btn" name="del" onclick="deleteselect();" value="<%out("lang_batchdelete")%>"/>
<%out("lang_special")%>
<select name="specialid">
<option value="0"><%out("lang_top_none")%></option>
<%Call ShowSpecialOption("")%>	
</select>
<input type="button"  class="btn" name="spec" onclick="specialselect();" value="<%out("lang_batchspecial")%>"/>
<%out("lang_category")%>
<select name="upper" id="upper">
<%Call ShowTypeOptions("add_modify_product","","","",1,1)%>
</select>
<input type="button"  class="btn" name="spec" onclick="batchtype();" value="<%out("lang_batchstype")%>"/>
</td>
</tr>
</table>
</form>
<div id="bottompage">
<%MyPage.ShowPage()%>
<span class="recordcount">
<%MyPage.ShowPageInfo()%>
</span>
</div>
<%Set MyPage=Nothing%>
</body>
</html>